home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_inv_batterys.cog < prev    next >
Text File  |  1998-09-17  |  831b  |  44 lines

  1. # DroidWorks
  2. # Battery item cog
  3. #
  4. # Each battery supplies 1000 power units
  5. #
  6. # Battery is in inventory bin 16
  7. # Power is in inventory bin 20
  8.  
  9. symbols
  10.  
  11. thing    player
  12.  
  13. message    activated
  14.  
  15. sound    batteryActivate=NRG00tBattUse.wav
  16.  
  17. end
  18.  
  19. # ========================================================================================
  20.  
  21. code
  22.  
  23. activated:
  24.      print("activated");
  25.     player = GetSourceRef();
  26.  
  27.     if (GetInv(player, 16) > 0)
  28.     {
  29.         if (GetInv(player, 20) < GetInvMax(player, 20))
  30.         {
  31.             print("using small battery");
  32.  
  33.             if (dwcheckDroidCaps(1048576)!=0) dwplayplayerspeech("", 510);
  34.                
  35.             PlaySoundlocal(batteryActivate, 1.0, 0.0, 0);
  36.             ChangeInv(player, 20, 1000);
  37.             ChangeInv(player, 16, -1);
  38.             if(GetInv(player, 16) == 0) SetInvAvailable(player, 16, 0);
  39.         }
  40.     }
  41.     return;
  42.  
  43. end
  44.